<template>
    <div class="home-container">
        <h1>主页</h1>
        <span>可设置指定 appkey</span>
        <van-cell-group>
            <van-field
                v-model.trim="value"
                label="appkey"
                placeholder="请输入appkey"
                @blur="set_appkey"
                @keyup.enter="set_appkey"
            />
        </van-cell-group>
        <a
            class="to-manage"
            href="https://jia-hui00.gitee.io/mall-business/"
            target="_blank"
            >后台管理入口
        </a>
    </div>
</template>

<script>
import { Toast } from "vant"

export default {
    name: "Home",
    data() {
        return {
            value: ""
        }
    },
    methods: {
        set_appkey() {
            if (!this.value) {
                return
            }
            this.$store.commit("set_appkey", this.value)
            Toast("设置成功")
        }
    }
}
</script>

<style lang="less">
@import url(~@/assets/css/var.less);
.home-container {
    background-color: #eee;
    height: 100vh;
    h1 {
        text-align: center;
    }
    span {
        font-size: 15px;
    }
    .to-manage {
        color: @primary;
        font-size: 17px;
        display: block;
        text-align: center;
        margin: 15px auto;
    }
}
</style>
